/*
 * Base64.h
 *
 *  Created on: 22/08/2012
 *      Author: Jairo
 */

#ifndef BASE64_H_
#define BASE64_H_

#include "defs.h"

namespace security
{
	class Base64
	{
	public:
		/**
		 * @param decoded
		 * @param length
		 * @param encoded
		 *
		 * @return
		 */
		static bool encode(const byte* decoded, int length, String& encoded);

		/**
		 * @param encoded
		 * @param decoded
		 * @param length
		 *
		 * @return
		 */
		static bool decode(const String& decoded, byte*& encoded, unsigned int& length);

	protected:
		/**
		 * @param b
		 *
		 * @return
		 */
		static bool is_base(byte b);
	};
} /* namespace security */

#endif /* BASE64_H_ */
